home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / pcplus2.zip / HOST.ASP < prev    next >
Text File  |  1988-01-01  |  12KB  |  409 lines

  1. ;*************************************************************************
  2. ;* HOST.ASP  (C) 1987 DATASTORM TECHNOLOGIES, INC.                       *
  3. ;*                                                                       *
  4. ;* A sample ASPECT script file for PROCOMM PLUS to illustrate the use    *
  5. ;* of various ASPECT commands (and provide a way to consistently and     *
  6. ;* easily invoke HOST mode).                                             *
  7. ;*                                                                       *
  8. ;*************************************************************************
  9.  
  10. goto begin
  11.  
  12. ;
  13. ;   Frequently called subroutines should be placed at the beginning of
  14. ;   an ASPECT file for maximum efficiency.
  15. ;
  16.  
  17. ;****************************************;
  18. ;* statbox:  Fill in the status window. *;
  19. ;****************************************;
  20. statbox:
  21.    fatsay 8  35 15 "%-30s" s5
  22.    fatsay 9  35 15 "%-30s" s4
  23.    if zero n3
  24.       atsay 12 35 15  "Immediate"
  25.    else
  26.       atoi s3 n0
  27.       fatsay 12 35 15 "%s:%02d     " s2 n0
  28.    endif
  29.    if not zero n1
  30.       atsay 13 35 15  "Enabled "
  31.    else
  32.       atsay 13 35 15  "Disabled"
  33.    endif
  34.    if zero n2
  35.       atsay 14 35 15  "Just exit  "
  36.    else
  37.       atsay 14 35 15  "Exit to DOS"
  38.    endif
  39. return
  40.  
  41. ;***********************************;
  42. ;* begin:  Logical starting place. *;
  43. ;***********************************;
  44. begin:
  45. gosub init                             ; You should go customize 'init'
  46. gosub mainmenu                         ; display the main menu
  47. top:                                   ; We come here after each key
  48.    gosub statbox                       ; alsways show the stat box
  49.    assign s1 "Which one ?                                "
  50.    atsay 20  7 79 s1
  51.    locate 20 19
  52.    curon
  53.    keyget s1
  54.    switch s1
  55.       case "A"
  56.          help
  57.          endcase
  58.       case "Q"
  59.          goto done
  60.          endcase
  61.       case "S"
  62.          gosub setime
  63.          endcase
  64.       case "B"
  65.          goto beginhst
  66.          endcase
  67.       case "V"
  68.          dir "*.*"
  69.          endcase
  70.       case "D"
  71.          gosub setdl
  72.          endcase
  73.       case "H"
  74.          gosub help
  75.          endcase
  76.       case "U"
  77.          gosub setul
  78.          endcase
  79.       case "L"
  80.          atsay 20  7 79  "Press Enter and then Alt-P"
  81.          locate 20 37
  82.          get s1 0
  83.          help
  84.          endcase
  85.       case "C"                         ; toggle call back flag
  86.          if zero n1
  87.             inc n1
  88.          else
  89.             dec n1
  90.          endif
  91.          endcase
  92.       case "E"                         ; toggle quit all flag
  93.          if zero n2
  94.             inc n2
  95.          else
  96.             dec n2
  97.          endif
  98.          endcase
  99.       default
  100.          endcase
  101.    endswitch
  102.    goto top
  103. ;end main loop
  104.  
  105. done:
  106.   clear
  107.   exit
  108. ;********* end of main routine *********;
  109.  
  110.  
  111. ;*************************************;
  112. ;* beginhst:  Executes HOST command. *;
  113. ;*************************************;
  114. beginhst:
  115.    if not zero n3                      ; if delay is on, suspend
  116.       clear 0
  117.       atoi s3 n0
  118.       fatsay 20 15 14 "Suspended until:  %s:%02d        (ESC to abort)" s2 n0
  119.       suspend until s2 s3
  120.    endif
  121.    clear
  122.    host
  123.    if not zero n1
  124.       goto callback
  125.    endif
  126.    if zero n2
  127.       exit
  128.    else
  129.       quit
  130.    endif
  131.  
  132.  
  133. ;************************************;
  134. ;* chk_range: verify numeric entry  *;
  135. ;* input:      n0 - value to verify *;
  136. ;*             n8 - lower limit     *;
  137. ;*             n9 - upper limit     *;
  138. ;*             (n8 ≤ n9 !!)         *;
  139. ;* output:     global 'SUCCESS' set *;
  140. ;*             if:  n8 ≤ n0 ≤ n9.   *;
  141. ;*             reset otherwise.     *;
  142. ;************************************;
  143. chk_range:
  144.    assign s0 "!"                       ; (n0 is in the range)
  145.    strcmp s0 "!"                       ; set success to true
  146.    if LT n0 n8
  147.       goto chk_no
  148.    endif
  149.    if GT n0 n9
  150.       goto chk_no
  151.    endif
  152.    return                              ; and return
  153. chk_no:
  154.    strcmp s0 "?"                       ; set success to false
  155.    return                              ; and return
  156.  
  157.  
  158. ;************************************;
  159. ;* setime:  set suspend until time. *;
  160. ;************************************;
  161. setime:
  162.    assign s1 "What hour (00-23, <CR> for immediate) ?     "
  163.    atsay 20  7 79 s1
  164.    atget 20 47 78 2 s1
  165.    strcpy s2 s1
  166.    strcat s1 "Z"
  167.    strcmp s1 "Z"
  168.    if success                          ; if Enter, then
  169.       init n3 0                        ; turn off delay flag
  170.       return                           ; and exit
  171.    endif
  172.    atoi s2 n0                          ; else verify that entry
  173.    init n8 1                           ; is from 0
  174.    init n9 23                          ; to 23
  175.    gosub chk_range                     ; using function: chk_range
  176.    if not success
  177.       sound 440 50
  178.       pause 2
  179.       goto setime
  180.    endif                               ; else we have a starting time
  181.    assign s1 "What min. (00-59, <CR> for 00) ?            "
  182.    atsay 20  7 79 s1
  183.    atget 20 47 78 2 s1
  184.    strcpy s3 s1
  185.    strcat s1 "Z"
  186.    strcmp s1 "Z"
  187.    if not success                      ; if not default, verify entry
  188.       atoi s3 n0
  189.       init n8 0                           ; is from 0
  190.       init n9 59                          ; to 23
  191.       gosub chk_range                     ; using function: chk_range
  192.       if not success
  193.          sound 440 50
  194.          pause 2
  195.          goto setime
  196.       endif                               ; else we have a starting time
  197.    else
  198.       strcpy s3 "00"
  199.    endif
  200.    init n3 1                           ; turn on delay flag
  201.  
  202. return
  203.  
  204. ;************************************;
  205. ;* help: display help screen.       *;
  206. ;************************************;
  207. help:
  208.    box  4,30, 17,67  31
  209.    atsay  6   34  30   "No help is currently available"
  210.    atsay  8   34  30   "       (Press any key)"
  211.    keyget s0
  212. ;
  213. ;  Restore the status window
  214. ;
  215.    box  4,30, 17,67  7
  216.    atsay  6   38  112  " - Current settings - "
  217.    atsay  7   30 7   "╩"
  218.    atsay  8   30 7   "─ ─ "
  219.    atsay  9   30 7   "─ ─ "
  220.    atsay  10  30 7   "─ ─ "
  221.    atsay  12  30 7   "─ ─ "
  222.    atsay  13  30 7   "─ ─ "
  223.    atsay  14  30 7   "─ ─ "
  224.    atsay  15  30 7   "╦"
  225.    atsay  10 35 15    "(See status line)"
  226. return
  227.  
  228. ;************************************;
  229. ;* callback:                        *;
  230. ;************************************;
  231. callback:
  232.    transmit "Enter phone number: "
  233.    rget s1 25
  234.    transmit "^M^MIs this correct: "
  235.    transmit s1
  236.    transmit " (Y/N/Q)?"
  237.    rget  s0 1
  238.    switch s0
  239.       case "Q"
  240.          goto quitcb
  241.          endcase
  242.       case "Y"
  243.          init n0 5                     ; number of redial attempts
  244.          goto havenum
  245.          endcase
  246.       default
  247.          goto callback
  248.          endcase
  249.    endswitch
  250.  
  251. havenum:
  252.    transmit "^MAfter I disconnect, verify that your modem will answer^M"
  253.    pause 3
  254.    hangup
  255. tryagain
  256.    pause 2
  257.    mdial s1
  258.    pause 2
  259.    if not connected
  260.       dec n0
  261.       if LT n0 5
  262.          goto tryagain
  263.       else
  264.          goto begin
  265.       endif
  266.    endif
  267.    terminal
  268.  
  269. quitcb:
  270.    transmit "^Mreturning to host mode"
  271.    goto begin
  272. return
  273.  
  274. ;************************************;
  275. ;* setul: set upload directory.     *;
  276. ;************************************;
  277. setul:
  278.    gosub getdir
  279.    if success
  280.       strcpy s4 s1
  281.       set dldir s4
  282.       chdir s5
  283.    endif
  284. return
  285.  
  286. ;************************************;
  287. ;* setdl: set download directory.   *;
  288. ;************************************;
  289. setdl:
  290.    gosub getdir
  291.    if success
  292.       strcpy s5 s1
  293.    endif
  294. return
  295. blankmsg:
  296.    assign s0 " "                          ; restore msg line
  297.    fatsay 20 7 79  "%60s" s0
  298. return
  299.  
  300. ;****************************************;
  301. ;* getdir: general getdir routine.      *;
  302. ;* input:  none                         *;
  303. ;* output:                              *;
  304. ;*     prompts user for directory name. *;
  305. ;*     if valid entry, then             *;
  306. ;*        SUCCESS = true and s1 = dir.  *;